package com.dollar.ruyuan_juc.promise.noPromise;

public class Test1 {
    public static void main(String[] args) throws InterruptedException {
        long start = System.currentTimeMillis();
        Thread t = new Thread(() -> {
            System.out.println("任务一开始：烧水，需要15分钟");
            try {
                BoilWater boilWater = new BoilWater();
                Thread.sleep(15000);
                boilWater.setStatus(true);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("任务一结束：烧水结束，用时：" +
                    (System.currentTimeMillis() - start));
        }, "boil water thread");
        t.start();
        t.join();

        System.out.println("任务二开始：准备茶叶茶杯，需要3分钟");
        TeaAndCup teaAndCup = new TeaAndCup();
        Thread.sleep(3000);
        teaAndCup.setStatus(true);
        System.out.println("任务二结束：茶叶茶杯结束。");
        System.out.println("准备工作结束，开始泡茶，makeTea");
        System.out.println("总共用时：" +
                (System.currentTimeMillis() - start));
    }
}
